package com.goldenlight.fvms.manager.vo;

import com.goldenlight.fvms.manager.entity.UserInfo;

public class Response <T>{
    private Integer code;
    private String msg;
    private T data;

    public Response(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }
    public Integer code() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
    public Response code(Integer code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }
    public String msg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
    public Response msg(String msg) {
        this.msg = msg;
        return this;
    }

    public T getData() {
        return data;
    }

    public T data() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
    public Response data(T data) {
        this.data = data;
        return this;
    }

    @Override
    public String toString() {
        return "Response{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public static <T> Response<T> build(Integer code, String msg, T t) {
        return new Response(code, msg, t);
    }

    public static Response build(Integer code, String msg) {
        return new Response(code, msg, null);
    }
}
